<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 联想小鑫
  Date: 2021/11/18
  Time: 9:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="js/jquery-1.8.2.min.js"></script>
</head>
<body>
${user.name}管理你好,以下为宿舍入住状况!
<form action="listguanliyuan.do" method="post">
    <input type="text"name="floorname" placeholder="请输入楼号或宿舍号" value="${floorname}">
    <input type="text"name="name" placeholder="请输入学生姓名" value="${name}" }>
    <input type="submit" value="查询">
</form>
<table border="1">
    <tr>
        <td>编号</td>
        <td>宿舍图片</td>
        <td>楼号</td>
        <td>宿舍号</td>
        <td>入住学生</td>
        <td>操作</td>
    </tr>
    <c:forEach items="${listguanliyuan}" var="s">
    <tr>
        <td>${s.id}</td>
        <td>
            <img src="${s.picture}" alt="该图片无法展示" height="50px" width="75px">
        </td>
        <td>${s.floorname}</td>
        <td>${s.dromno}</td>
        <td>${s.names}</td>
        <td>
            <button class="ck" value="${s.id}">查看详情</button>
        </td>
    </tr>
    </c:forEach>
    <tr>
        <td colspan="15">
            第${page.getPageNum()}页/${page.getPages()}页
            <button onclick="go(1)">首页</button>
            <button onclick="go(${page.getPageNum()}-1)">上一页</button>
            <button onclick="go(${page.getPageNum()}+1)">下一页</button>
            <button onclick="go(${page.getPages()})">尾页</button>
        </td>
    </tr>
</body>
<script>
    function go(pageNum) {
        location="listguanliyuan.do?pageNum="+pageNum+"&"+$("form").serialize();
    }
    $(".ck").click(function () {
        location="ckxq.do?id="+$(this).val();
    })
</script>
</html>
